C-Level Extensibility > The C-level extensibility API > JSBool JS_DefineFunction()

 

JSBool JS_DefineFunction()

Description

Registers a C-level function with the JavaScript interpreter in Dreamweaver. After this function returns, JavaScript scripts that call the function specified in name will execute the code pointed to by call.

Typically, this function is called from MM_Init(), which Dreamweaver calls during startup.

Arguments

char *name, JSNative call, unsigned int nargs

name is the name of the function as it is exposed to JavaScript.
call is a pointer to a C-level function. The function must accept the same arguments as readContentsOfFile, and it must return a JSBool indicating success or failure.
nargs is the number of arguments that the function expects to receive.

Returns

A Boolean value indicating success (JS_TRUE) or failure (JS_FALSE).